//
//  BLConsumeTableViewCell.m
//  blanket
//
//  Created by Mac on 2017/12/7.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "BLConsumeTableViewCell.h"
@interface BLConsumeTableViewCell()
@property(nonatomic, strong) STButton                     *nameButton;
@property(nonatomic, strong) STLabel                      *timeLable;//时间
@property(nonatomic, strong) STLabel                      *moneyLable;
@end
@implementation BLConsumeTableViewCell

+ (CGFloat)CellHeight{
    return 70;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
#pragma mark --subView
- (void)configSubView{
    self.backgroundColor = [UIColor whiteColor];
    
    self.nameButton = [[STButton alloc] initWithFrame:CGRectMake(15, 10, UIScreenWidth - 220, 20)
                                                title:@"床单1.2 * 24"
                                           titleColor:BL_firstTextColor
                                            titleFont:15
                                         cornerRadius:0
                                      backgroundColor:nil
                                      backgroundImage:nil
                                                image:[UIImage imageNamed:@"PC_zhanghumingxi"]];
    self.nameButton.titleEdgeInsets = UIEdgeInsetsMake(0, 8, 0, 0);
    [self addSubview:self.nameButton];
    
    
    self.moneyLable = [[STLabel alloc] initWithFrame:CGRectMake(0, 16, 200, 20)
                                                text:@"-200"
                                           textColor:BL_BlueBackGroundColor
                                                font:18
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentRight];
    self.moneyLable.st_right = UIScreenWidth - 15;
    self.moneyLable.st_centerY = [BLConsumeTableViewCell CellHeight]/2;
    [self addSubview:self.moneyLable];
    
    self.timeLable = [[STLabel alloc] initWithFrame:CGRectMake(0, _nameButton.st_bottom + 13, 300, 15)
                                               text:@"2017-09-21 13:21:05"
                                          textColor:BL_secendTextColor
                                               font:13
                                        isSizetoFit:NO
                                      textAlignment:NSTextAlignmentLeft];
    self.timeLable.left = self.nameButton.left + self.nameButton.imageView.size.width + 8;
    [self addSubview:self.timeLable];
    
    //line
    UIView * line = [[UIView alloc] initWithFrame:CGRectMake(0, [BLConsumeTableViewCell CellHeight] - 1, UIScreenWidth, 0.5)];
    line.backgroundColor = BL_lineColor;
    [self addSubview:line];
    
}
- (void)setModel:(BLXiaofeiModel *)model{
    _model = model;
    [self.nameButton setTitle:model.goods_spec forState:UIControlStateNormal];
    
    self.timeLable.text = model.create_time;
    
    self.moneyLable.text = model.price;
}
@end
